package com.zhs.demoutil.util;


import lombok.extern.slf4j.Slf4j;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;

import java.io.IOException;

/**
 * 执行命令返回结果
 */
@Slf4j
public class CmdUtils {

    public static void executeCmd(String cmd) throws IOException {
        CommandLine line = CommandLine.parse(cmd);
        DefaultExecutor executor = new DefaultExecutor();
        log.info("cmd: "+cmd);
        executor.execute(line);
    }
}
